# -*- coding: utf-8 -*-
import pygame
from pygame.locals import *
from pygame.sprite import Sprite

from robot import Robot
from ap import Ap

class Level(object):
	screen = pygame.display.set_mode((640, 480))
	pygame.display.set_caption("El robot Cuartetero!!!")
	fondo = pygame.image.load("fondo3.png").convert()
	pygame.mixer.init()
	back_sound = pygame.mixer.Sound("funky.wav")
	back_sound.set_volume(0.5)
	back_sound.play(-1)	
	temporizador = pygame.time.Clock()
	robot = Robot()
	ap = Ap(screen)	
	salir = False
	
	while not salir:
		robot.update()
		ap.update()
		# actualizacion grafica
		screen.blit(fondo, (0, 0))
		screen.blit(robot.image, robot.rect)
		screen.blit(ap.image, ap.rect)
		ap.circle.paint()
		pygame.display.flip()
		temporizador.tick(60)
		pygame.time.delay(30)
			# gestion de eventos
		for evento in pygame.event.get():
			if evento.type == pygame.QUIT:
				salir = True
		back_sound.stop()
